﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Trans.trans;
using Trans.DataSetTableAdapters;

namespace Trans.car
{
    public partial class Manage_charge : Form
    {
        DataRowView crow;
        public Manage_charge()
        {
            InitializeComponent();
        }

        private void Manage_charge_Load(object sender, EventArgs e)
        {
            
            this.tb_chargeTableAdapter.Fill(this.dataSet.tb_charge);
         
        }


        private void bt_save_Click(object sender, EventArgs e)
        {
            tbchargeBindingSource.EndEdit();
            tb_chargeTableAdapter.Update(dataSet.tb_charge);
            this.Close();
        }

        private void bt_cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void gv_charges_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            crow=(DataRowView)tbchargeBindingSource.Current;
            tb_carTableAdapter.FillById(dataSet.tb_car,(int)crow["car_id"]);
          
        }

        private void bt_car_Click(object sender, EventArgs e)
        {
            Select_car f = new Select_car();
            f.ShowDialog();
            if(f.HasSelected)
            {
                int id = f.Id;
                crow["car_id"] = id;
                tb_carTableAdapter.FillById(dataSet.tb_car,id);
            }
        }

        private void bt_trans_Click(object sender, EventArgs e)
        {
            Select_trans f = new Select_trans();
            f.ShowDialog();
            if (f.HasSelected)
            {
                int id = f.ID;
                crow["trans_id"] = id;
                tb_transTableAdapter.FillById(dataSet.tb_trans, id);
            }
        }

        private void gv_charges_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
        {
            session.Color_Const.set_gv_color(gv_charges);
        }

        private void textBoxX2_TextChanged(object sender, EventArgs e)
        {

        }

        private void ultraLabel5_Click(object sender, EventArgs e)
        {

        }

        private void tx_car_TextChanged(object sender, EventArgs e)
        {

        }

        private void ultraLabel4_Click(object sender, EventArgs e)
        {

        }

        private void ultraLabel3_Click(object sender, EventArgs e)
        {

        }

        private void textBoxX3_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBoxX1_TextChanged(object sender, EventArgs e)
        {

        }

        private void ultraLabel2_Click(object sender, EventArgs e)
        {

        }

        private void lable_city_Click(object sender, EventArgs e)
        {

        }

        private void tx_trans_TextChanged(object sender, EventArgs e)
        {

        }

        private void ultraLabel10_Click(object sender, EventArgs e)
        {

        }

        private void ultraLabel7_Click(object sender, EventArgs e)
        {

        }
    }
}
